﻿namespace MelodysDemo.Core.Models
{
    /// <summary>
    /// 问题信息表
    /// </summary>
    [Table("survey_question")]
    [Index("QuestionnaireId", Name = "questionnaire_id")]
    public partial class SurveyQuestion
    {
        public SurveyQuestion()
        {
            SurveyAnswerDetails = new HashSet<SurveyAnswerDetail>();
            SurveyOptions = new HashSet<SurveyOption>();
        }

        /// <summary>
        /// 自增主键
        /// </summary>
        [Key]
        [Column("id")]
        public long Id { get; set; }
        /// <summary>
        /// 问卷ID
        /// </summary>
        [Column("questionnaire_id")]
        public long QuestionnaireId { get; set; }
        /// <summary>
        /// 序号
        /// </summary>
        [Column("sn")]
        public byte Sn { get; set; }
        /// <summary>
        /// 问题/题干
        /// </summary>
        [Required]
        [Column("title")]
        [StringLength(1024)]
        public string Title { get; set; }
        /// <summary>
        /// 分值
        /// </summary>
        [Column("score")]
        public byte Score { get; set; }
        /// <summary>
        /// 版本号
        /// </summary>
        [Column("version")]
        public long Version { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("create_time")]
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        [Required]
        [Column("creator")]
        [StringLength(64)]
        public string Creator { get; set; }
        /// <summary>
        /// 修改时间
        /// </summary>
        [Column("modified_time")]
        public DateTime ModifiedTime { get; set; }
        /// <summary>
        /// 修改人
        /// </summary>
        [Required]
        [Column("modifier")]
        [StringLength(64)]
        public string Modifier { get; set; }
        /// <summary>
        /// 是否删除，0：否，1：是
        /// </summary>
        [Column("is_delete")]
        public byte IsDelete { get; set; }

        [ForeignKey("QuestionnaireId")]
        [InverseProperty("SurveyQuestions")]
        public virtual SurveyQuestionnaire Questionnaire { get; set; }
        [InverseProperty("Question")]
        public virtual ICollection<SurveyAnswerDetail> SurveyAnswerDetails { get; set; }
        [InverseProperty("Question")]
        public virtual ICollection<SurveyOption> SurveyOptions { get; set; }
    }
}